package com.pm.business.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.pm.common.annotation.Log;
import com.pm.common.core.controller.BaseController;
import com.pm.common.core.domain.AjaxResult;
import com.pm.common.enums.BusinessType;
import com.pm.business.domain.BidProjectWorkflowPoint;
import com.pm.business.service.IBidProjectWorkflowPointService;
import com.pm.common.utils.poi.ExcelUtil;
import com.pm.common.core.page.TableDataInfo;

/**
 * 投标流程管理Controller
 * 
 * @author zxl
 * @date 2022-05-05
 */
@RestController
@RequestMapping("/business/bid_project_workflow_point")
public class BidProjectWorkflowPointController extends BaseController
{
    @Autowired
    private IBidProjectWorkflowPointService bidProjectWorkflowPointService;

    /**
     * 查询投标流程管理列表
     */
    @PreAuthorize("@ss.hasPermi('business:bid_project_workflow_point:list')")
    @GetMapping("/list")
    public TableDataInfo list(BidProjectWorkflowPoint bidProjectWorkflowPoint)
    {
        startPage();
        List<BidProjectWorkflowPoint> list = bidProjectWorkflowPointService.selectBidProjectWorkflowPointList(bidProjectWorkflowPoint);
        return getDataTable(list);
    }

    /**
     * 导出投标流程管理列表
     */
    @PreAuthorize("@ss.hasPermi('business:bid_project_workflow_point:export')")
    @Log(title = "投标流程管理", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, BidProjectWorkflowPoint bidProjectWorkflowPoint)
    {
        List<BidProjectWorkflowPoint> list = bidProjectWorkflowPointService.selectBidProjectWorkflowPointList(bidProjectWorkflowPoint);
        ExcelUtil<BidProjectWorkflowPoint> util = new ExcelUtil<BidProjectWorkflowPoint>(BidProjectWorkflowPoint.class);
        util.exportExcel(response, list, "投标流程管理数据");
    }

    /**
     * 获取投标流程管理详细信息
     */
    @PreAuthorize("@ss.hasPermi('business:bid_project_workflow_point:query')")
    @GetMapping(value = "/{pointId}")
    public AjaxResult getInfo(@PathVariable("pointId") Long pointId)
    {
        return AjaxResult.success(bidProjectWorkflowPointService.selectBidProjectWorkflowPointByPointId(pointId));
    }

    /**
     * 新增投标流程管理
     */
    @PreAuthorize("@ss.hasPermi('business:bid_project_workflow_point:add')")
    @Log(title = "投标流程管理", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody BidProjectWorkflowPoint bidProjectWorkflowPoint)
    {
        return toAjax(bidProjectWorkflowPointService.insertBidProjectWorkflowPoint(bidProjectWorkflowPoint));
    }

    /**
     * 修改投标流程管理
     */
    @PreAuthorize("@ss.hasPermi('business:bid_project_workflow_point:edit')")
    @Log(title = "投标流程管理", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody BidProjectWorkflowPoint bidProjectWorkflowPoint)
    {
        return toAjax(bidProjectWorkflowPointService.updateBidProjectWorkflowPoint(bidProjectWorkflowPoint));
    }

    /**
     * 删除投标流程管理
     */
    @PreAuthorize("@ss.hasPermi('business:bid_project_workflow_point:remove')")
    @Log(title = "投标流程管理", businessType = BusinessType.DELETE)
	@DeleteMapping("/{pointIds}")
    public AjaxResult remove(@PathVariable Long[] pointIds)
    {
        return toAjax(bidProjectWorkflowPointService.deleteBidProjectWorkflowPointByPointIds(pointIds));
    }
}
